///###############
//FILE          : SortedStructure.java
//WRITER        : Lior Zimmerman, liorz06, 066462300
//WRITER        : Ohad Dan, ohad_dan, 036767960
//EXERCISE      : oop ex1 2008
//DESCRIPTION   : this interface defines the capabilities of a sorted structure
//###############

package oop.ex1.sortedStructure;
import java.util.List;

/**
 * An interface of a sorted structure.
 * @param <Key> The key by which the sorting will be made.
 * @param <InfoType> The data that will be held by the sorted structure.
 */
public interface SortedStructure
<Key extends Comparable<Key>, InfoType extends Keyed<Key> > {
	/**
	 * Returns true if the structure is empty, false otherwise.
	 * @return True if the structure is empty, false otherwise.
	 */
	public boolean  isEmpty();
	/**
	 * Returns the size of the tree - number leaves.
	 * @return Tree size.
	 */
    public int size();
    /**
     * Inserts new data.
     * @param data - data to be inserted.
     * @throws SortedStructureNullException case of null insertion.
     * @throws SortedStructureDuplicateException in case the given 
     * data already contained in the structure.
     */
    public void insert(InfoType data) throws SortedStructureException;
    /**
     * Returns the instance with given key.
     * @param key the key of the desired instance.
     * @return The instance with given key.
     */
    public InfoType get (Key key);
    /**
     * Remove an in instance from the list.
     * @param key The key of the instance to be removed.
     * @return The removed instance, or null if given key doedsn't exist.
     */
    public InfoType remove (Key key);  
    /**
     * Returns all the keys of the structure instances.
     * @return A list with all the structure's keys.
     */
    public List<Key> getAllKeys();
    /**
     * Returns a string representation of the structure.
     * @param sep Separator between two instances. 
     * @return A String with the structure's data. 
     */
    public String toString(String sep);
}